import type { RouteLocationNormalizedLoaded } from 'vue-router'
import { store } from '../index' 

export interface TagsViewState {
    visitedViews: RouteLocationNormalizedLoaded[],
    cachedViews: Set<string>,
    selectedTag?: RouteLocationNormalizedLoaded
}

export const useTagsViewStore = defineStore('tagsView', {
    state: (): TagsViewState => ({
        visitedViews: [],
        cachedViews: new Set(),
        selectedTag: undefined
    }),
    getters: {
        getVisitedViews(): RouteLocationNormalizedLoaded[] {
            return this.visitedViews
        },
        getCachedViews(): string[] {
            return Array.from(this.cachedViews)
        },
        getSelectedTag(): RouteLocationNormalizedLoaded | undefined {
            return this.selectedTag
        }
    },
    actions: {
        
    },
    persist: false
})

export const useTagsViewStoreWithOut = () => {
    return useTagsViewStore(store)
}